<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
</head>
<body>
<input type="button" value="查询用户">
<div></div>
<script>
	document.querySelector("input").onclick=function () {
		var xhr = new XMLHttpRequest();
		xhr.open("get","xml.php");

		xhr.send(null);
		xhr.onreadystatechange=function () {
			if(xhr.readyState===4 && xhr.status===200){
				var dom = xhr.responseXML;
				var users = dom.querySelectorAll("user");
				console.log(users[0]);
			}
		}
	}
</script>
</body>
</html>